package models

import (
	"xy_api/pkg/model"
)

type User struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

func (User) TableName() string {
	return "user"
}

func UserInfo(id int64) (User, error) {
	var user User
	err := model.DB.Where("id=?", id).Find(&user).Error
	if err != nil {
		return user, err
	}
	return user, nil
}
